<html>
<head><meta charset="utf-8"><title>interning next steps · t-compiler/wg-mir-opt · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/index.html">t-compiler/wg-mir-opt</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html">interning next steps</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="177089934"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177089934" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177089934">(Oct 01 2019 at 19:35)</a>:</h4>
<p>So <span class="user-mention" data-user-id="116266">@Santiago Pastorino</span> I was thinking that, after <a href="https://github.com/rust-lang/rust/issues/64922" target="_blank" title="https://github.com/rust-lang/rust/issues/64922">#64922</a>, the next step for interning is probably modifying the <code>MutVisitor</code> so that they don't visit the <em>contents</em> of places</p>



<a name="177089979"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177089979" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177089979">(Oct 01 2019 at 19:36)</a>:</h4>
<p>well, all visitors I guess</p>



<a name="177089991"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177089991" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177089991">(Oct 01 2019 at 19:36)</a>:</h4>
<p>since once we intern we're going to have to visit a place as an atomic thing</p>



<a name="177090006"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177090006" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177090006">(Oct 01 2019 at 19:36)</a>:</h4>
<p>I'm not sure how big a change this will be</p>



<a name="177090521"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177090521" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177090521">(Oct 01 2019 at 19:43)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> I was starting to add the methods we talked about yesterday</p>



<a name="177090530"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177090530" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177090530">(Oct 01 2019 at 19:43)</a>:</h4>
<p>do you think I should stop that and switch to this?</p>



<a name="177090592"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177090592" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177090592">(Oct 01 2019 at 19:44)</a>:</h4>
<blockquote>
<p>since once we intern we're going to have to visit a place as an atomic thing</p>
</blockquote>
<p>unsure why is this, we are interning only the projections of a place first, right?</p>



<a name="177090601"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177090601" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177090601">(Oct 01 2019 at 19:44)</a>:</h4>
<p>if we are interning projections, why do we end visiting a place as an atomic thing?</p>



<a name="177090639"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177090639" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177090639">(Oct 01 2019 at 19:45)</a>:</h4>
<blockquote>
<p>So <span class="user-mention silent" data-user-id="116266">Santiago Pastorino</span> I was thinking that, after <a href="https://github.com/rust-lang/rust/issues/64922" target="_blank" title="https://github.com/rust-lang/rust/issues/64922">#64922</a>, the next step for interning is probably modifying the <code>MutVisitor</code> so that they don't visit the <em>contents</em> of places</p>
</blockquote>
<p>If you don't visit contents of places what do you do on each visitor? or how do you emulate what visitors are right now doing?</p>



<a name="177090653"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177090653" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177090653">(Oct 01 2019 at 19:45)</a>:</h4>
<p>trying to understand exactly what I need to accomplish</p>



<a name="177091303"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177091303" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177091303">(Oct 01 2019 at 19:53)</a>:</h4>
<blockquote>
<p>I was starting to add the methods we talked about yesterday</p>
</blockquote>
<p>which methods, <span class="user-mention" data-user-id="116266">@Santiago Pastorino</span> ?</p>



<a name="177091359"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177091359" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177091359">(Oct 01 2019 at 19:54)</a>:</h4>
<blockquote>
<p>if we are interning projections, why do we end visiting a place as an atomic thing?</p>
</blockquote>
<p>ok well we can visit the "base"</p>



<a name="177091366"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177091366" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177091366">(Oct 01 2019 at 19:54)</a>:</h4>
<p>but we can't mut-visit the projections</p>



<a name="177091372"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177091372" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177091372">(Oct 01 2019 at 19:54)</a>:</h4>
<p>because they are interned</p>



<a name="177091404"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177091404" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177091404">(Oct 01 2019 at 19:54)</a>:</h4>
<blockquote>
<p>If you don't visit contents of places what do you do on each visitor? or how do you emulate what visitors are right now doing?</p>
</blockquote>
<p>I guess we have to look at the visitors and see what they do</p>



<a name="177091421"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177091421" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177091421">(Oct 01 2019 at 19:54)</a>:</h4>
<p>for the non-mut visitors, we could have an auxiliary "place visitor" trait</p>



<a name="177091435"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177091435" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177091435">(Oct 01 2019 at 19:55)</a>:</h4>
<p>that visits the base/projections as today</p>



<a name="177091439"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177091439" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177091439">(Oct 01 2019 at 19:55)</a>:</h4>
<p>but is always read-only</p>



<a name="177091476"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177091476" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177091476">(Oct 01 2019 at 19:55)</a>:</h4>
<p>for the <em>mut</em> visitors, well, we'll have to look carefully, they may need to do a "map" where they produce a new place and then store the whole thing back</p>



<a name="177091573"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177091573" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177091573">(Oct 01 2019 at 19:56)</a>:</h4>
<blockquote>
<blockquote>
<p>I was starting to add the methods we talked about yesterday</p>
</blockquote>
<p>which methods, <span class="user-mention silent" data-user-id="116266">Santiago Pastorino</span> ?</p>
</blockquote>
<p>I meant, I started to play with the interning process, adding these _intern_predicate like methods</p>



<a name="177091782"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177091782" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177091782">(Oct 01 2019 at 19:59)</a>:</h4>
<p>ok I got that we can't mut-visit the projections because they are interned</p>



<a name="177091815"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177091815" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177091815">(Oct 01 2019 at 19:59)</a>:</h4>
<p>the place visitor I guess makes sense</p>



<a name="177092007"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177092007" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177092007">(Oct 01 2019 at 20:01)</a>:</h4>
<blockquote>
<p>for the <em>mut</em> visitors, well, we'll have to look carefully, they may need to do a "map" where they produce a new place and then store the whole thing back</p>
</blockquote>
<p>I wonder then how do you solve this, I guess all you're saying is that we can't just implement the mut visitor because we have an interned structure but we need to mutate that in some different way</p>



<a name="177092030"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177092030" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177092030">(Oct 01 2019 at 20:01)</a>:</h4>
<p>I guess I'd need to take a look around to see what's exactly the issue</p>



<a name="177092047"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177092047" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177092047">(Oct 01 2019 at 20:01)</a>:</h4>
<p>so my main question about this is ...</p>



<a name="177092130"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177092130" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177092130">(Oct 01 2019 at 20:02)</a>:</h4>
<p>are you proposing that I should fix the mut visitors issue before hand? like to leave the code prepared for the interning case?</p>



<a name="177092209"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177092209" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177092209">(Oct 01 2019 at 20:03)</a>:</h4>
<p>or should I do all at once and fix the visitors once I see the compiler error I'm getting when using <code>List&lt;PlaceElem&lt;'tcx&gt;&gt;</code>?</p>



<a name="177093043"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177093043" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177093043">(Oct 01 2019 at 20:11)</a>:</h4>
<blockquote>
<p>I meant, I started to play with the interning process, adding these _intern_predicate like methods</p>
</blockquote>
<p>I see. I think that's a bit premature, we should fix the visitor things first.</p>



<a name="177093062"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177093062" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177093062">(Oct 01 2019 at 20:11)</a>:</h4>
<blockquote>
<p>are you proposing that I should fix the mut visitors issue before hand? like to leave the code prepared for the interning case?</p>
</blockquote>
<p>yep</p>



<a name="177093072"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177093072" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177093072">(Oct 01 2019 at 20:11)</a>:</h4>
<p>cool</p>



<a name="177093073"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177093073" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177093073">(Oct 01 2019 at 20:11)</a>:</h4>
<p>I think you'd be happier trying to debug the visitor changes in isolation :)</p>



<a name="177093101"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177093101" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177093101">(Oct 01 2019 at 20:11)</a>:</h4>
<p>yeah it makes sense</p>



<a name="177093206"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177093206" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177093206">(Oct 01 2019 at 20:12)</a>:</h4>
<p>in general in the mut version, I guess you get the projection from the arena, modify it locally and reintern it?</p>



<a name="177093286"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177093286" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177093286">(Oct 01 2019 at 20:12)</a>:</h4>
<p>I mean, I guess you don't mut visit the projection but you still will need to modify it</p>



<a name="177093403"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177093403" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177093403">(Oct 01 2019 at 20:13)</a>:</h4>
<p>talking about interning, I know that I shouldn't do it for now but I still don't know to what I should change the visitors because I guess I don't understand the problem that the interning process is going to give me</p>



<a name="177093575"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177093575" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177093575">(Oct 01 2019 at 20:15)</a>:</h4>
<p>So right now, <a href="https://doc.rust-lang.org/nightly/nightly-rustc/rustc/mir/visit/trait.MutVisitor.html#method.visit_place" target="_blank" title="https://doc.rust-lang.org/nightly/nightly-rustc/rustc/mir/visit/trait.MutVisitor.html#method.visit_place">visit_place</a> has a <code>&amp;mut Place</code> and since <code>Place</code> owns the <code>Box</code>, <code>visit_place()</code> is free to mutate it</p>



<a name="177093597"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177093597" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177093597">(Oct 01 2019 at 20:15)</a>:</h4>
<p>Once we start interning, <code>Place</code> will only have a <code>&amp;'tcx Box&lt;[PlaceElem]&gt;</code> or whatever</p>



<a name="177093624"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177093624" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177093624">(Oct 01 2019 at 20:16)</a>:</h4>
<p>which means the code can no longer mutate the projections</p>



<a name="177093711"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177093711" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177093711">(Oct 01 2019 at 20:17)</a>:</h4>
<p>It can however mutate the <code>Place</code> so whatever it is currently doing needs to be changed from mutating the projections in the Place directly to generating a new <code>Box&lt;[PlaceElem]&gt;</code> that we can intern and then assign to the <code>&amp;mut Place</code> we have</p>



<a name="177093868"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177093868" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177093868">(Oct 01 2019 at 20:18)</a>:</h4>
<p>(if I understand correctly)</p>



<a name="177096846"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177096846" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177096846">(Oct 01 2019 at 20:49)</a>:</h4>
<p>(cc <span class="user-mention" data-user-id="116009">@nikomatsakis</span> in case I'm totally wrong)</p>



<a name="177097127"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177097127" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177097127">(Oct 01 2019 at 20:52)</a>:</h4>
<p>that seems reasonable</p>



<a name="177110229"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177110229" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177110229">(Oct 02 2019 at 00:07)</a>:</h4>
<p>yep, that's it</p>



<a name="177179589"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177179589" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177179589">(Oct 02 2019 at 18:41)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> I'm making some progress with this task but I was wondering ...</p>



<a name="177179604"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177179604" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177179604">(Oct 02 2019 at 18:41)</a>:</h4>
<p>one easy way to solve this is to make visit_projection return a projection</p>



<a name="177179620"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177179620" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177179620">(Oct 02 2019 at 18:41)</a>:</h4>
<p>and so the rest of the visit_* methods that visit_projection use</p>



<a name="177179702"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177179702" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177179702">(Oct 02 2019 at 18:42)</a>:</h4>
<p>but that doesn't seem like a great design and even less something that a visitor would do :)</p>



<a name="177179753"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177179753" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177179753">(Oct 02 2019 at 18:43)</a>:</h4>
<p>the other possibility is to have everything solved on visit_place</p>



<a name="177179840"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177179840" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177179840">(Oct 02 2019 at 18:43)</a>:</h4>
<p>but still there are visit_ty and visit_local that mutates the thing and we would need those to return a new ty or new local and not to mutate</p>



<a name="177179999"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177179999" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177179999">(Oct 02 2019 at 18:45)</a>:</h4>
<p>and also, is not a thing of just changing visit_ty to make it return because that one is used in other visitor methods</p>



<a name="177180056"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177180056" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177180056">(Oct 02 2019 at 18:46)</a>:</h4>
<p>it's more like we need a read only version of those</p>



<a name="177180107"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177180107" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177180107">(Oct 02 2019 at 18:46)</a>:</h4>
<p>I can provide a solution to this that works still wonder how to properly fit things in the current design</p>



<a name="177226219"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177226219" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177226219">(Oct 03 2019 at 09:05)</a>:</h4>
<p><span class="user-mention" data-user-id="116266">@Santiago Pastorino</span> yeah so I think we have to be careful what we are talking about here. I'm feeling a bit confused. Today's design has a split:</p>
<ul>
<li>the visitor (<code>fn visit(&amp;T)</code>) -- read-only access to the things in the MIR</li>
<li>the mut visitor (<code>fn visit(&amp;mut T)</code>) -- gives <code>&amp;mut</code> access to the things in the MIR</li>
</ul>
<p>Right now, these two visitors always visit the same set of things, but in one case you get to make "in place" changes. I think this is overall a nice pattern that we should <em>probably</em> keep, but indeed there is another alternative: you can have what we often call a "folder", where the basic signature is <code>fn fold(&amp;T) -&gt; T</code>. But this has the problem that "read-only" visits are really wasteful now, so it's often paired with a visitor <code>fn visit(&amp;T)</code>. It's also not great for making small edits. I rather prefer the existing mut visitor, though it might be a good idea to survey the uses and see how often we're really using it.</p>
<p>This is why I am advocating for moving the "visit the parts of a place" <strong>out</strong> from the <strong>MIR visitor</strong> to a separate visitor. So then you can decide how you want to visit those parts, and it can use a distinct strategy -- probably it would just use the <code>TypeFolder</code> methods, actually, since I think the only thing we ever want to visit inside of places is types.</p>



<a name="177226229"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177226229" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177226229">(Oct 03 2019 at 09:05)</a>:</h4>
<p>If you want <span class="user-mention" data-user-id="116266">@Santiago Pastorino</span> maybe we can schedule a bit of time to talk over this sync?</p>



<a name="177249712"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177249712" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177249712">(Oct 03 2019 at 14:28)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> yeah, please let's sync about this for a bit</p>



<a name="177284286"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177284286" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177284286">(Oct 03 2019 at 20:21)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> so I understand what you mean at high level</p>



<a name="177284388"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177284388" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177284388">(Oct 03 2019 at 20:22)</a>:</h4>
<p>when you say move "visit the parts of a place" out from the MIR visitor to a separate visitor</p>



<a name="177284425"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177284425" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177284425">(Oct 03 2019 at 20:22)</a>:</h4>
<p>I also get that we would need to move out from there things that are going to be interned because MutVisitor won't play nice with that</p>



<a name="177284476"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177284476" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177284476">(Oct 03 2019 at 20:23)</a>:</h4>
<p>the thing I guess now is how would be MIR Visitor work then?</p>



<a name="177284497"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177284497" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177284497">(Oct 03 2019 at 20:23)</a>:</h4>
<p>it will call that other visitor to visit place?</p>



<a name="177284700"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177284700" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177284700">(Oct 03 2019 at 20:25)</a>:</h4>
<p>and I'm also understanding that that other visitor would need to take a read only place or place part or more specifically for this case would be a read only projection and return a new one by using TypeFolder methods</p>



<a name="177284746"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177284746" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177284746">(Oct 03 2019 at 20:25)</a>:</h4>
<p>just wonder how the pieces fit together</p>



<a name="177321003"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177321003" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177321003">(Oct 04 2019 at 08:54)</a>:</h4>
<p>The mut visitor can also have <code>fn visit_place_projection(&amp;mut &amp;'tcx [PlaceElem&lt;'tcx&gt;])</code>, so you can mutate, but you have to put back a <code>&amp;'tcx [PlaceElem&lt;'tcx&gt;]</code> in one go</p>



<a name="177333588"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177333588" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177333588">(Oct 04 2019 at 12:29)</a>:</h4>
<p>it could, but I would avoid that</p>



<a name="177333608"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177333608" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177333608">(Oct 04 2019 at 12:29)</a>:</h4>
<p>in particular, if we move towards interning an entire place</p>



<a name="177333613"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177333613" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177333613">(Oct 04 2019 at 12:29)</a>:</h4>
<p>it'll just mean more work</p>



<a name="177333680"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177333680" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177333680">(Oct 04 2019 at 12:30)</a>:</h4>
<p>I think it's easier to consider places a "leaf" type for the visitor, much like types</p>



<a name="177333697"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177333697" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177333697">(Oct 04 2019 at 12:30)</a>:</h4>
<p>but I don't have a strong opinion on that</p>



<a name="177333703"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177333703" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177333703">(Oct 04 2019 at 12:30)</a>:</h4>
<p>the more important thing would be to go through the visitors and see how they use the visit place methods</p>



<a name="177334069"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177334069" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177334069">(Oct 04 2019 at 12:36)</a>:</h4>
<p>I get</p>
<div class="codehilite"><pre><span></span>/home/nmatsakis/.cargo/bin/rg --no-heading --color never &#39;fn visit_place\(|fn visit_place_base\(|fn visit_projection\(&#39;
librustc_codegen_ssa/mir/analyze.rs:245:    fn visit_place(&amp;mut self,
librustc_mir/transform/inline.rs:677:    fn visit_place(&amp;mut self,
librustc_mir/transform/qualify_consts.rs:1094:    fn visit_place_base(
librustc_mir/transform/qualify_consts.rs:1159:    fn visit_projection(
librustc_mir/monomorphize/collector.rs:659:    fn visit_place_base(&amp;mut self,
librustc_mir/transform/generator.rs:103:    fn visit_place(&amp;mut self,
librustc_mir/transform/generator.rs:130:    fn visit_place(&amp;mut self,
librustc_mir/transform/generator.rs:250:    fn visit_place(&amp;mut self,
librustc_mir/transform/check_unsafety.rs:199:    fn visit_place(&amp;mut self,
librustc/mir/visit.rs:147:            fn visit_place(&amp;mut self,
librustc/mir/visit.rs:154:            fn visit_place_base(&amp;mut self,
librustc/mir/visit.rs:161:            fn visit_projection(&amp;mut self,
librustc_mir/transform/check_consts/validation.rs:322:    fn visit_place_base(
librustc_mir/transform/check_consts/validation.rs:407:    fn visit_projection(
librustc_mir/borrow_check/nll/type_check/mod.rs:273:    fn visit_place(&amp;mut self, place: &amp;Place&lt;&#39;tcx&gt;, context: PlaceContext, location: Location) {
librustc_mir/borrow_check/nll/type_check/liveness/polonius.rs:68:    fn visit_place(&amp;mut self, place: &amp;Place&lt;&#39;tcx&gt;, context: PlaceContext, location: Location) {
</pre></div>



<a name="177334092"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177334092" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177334092">(Oct 04 2019 at 12:36)</a>:</h4>
<p>er that's the wrong list</p>



<a name="177334093"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177334093" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177334093">(Oct 04 2019 at 12:36)</a>:</h4>
<p>but it's a start</p>



<a name="177334103"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177334103" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177334103">(Oct 04 2019 at 12:37)</a>:</h4>
<p>I guess what we <em>most</em> want to check are the <code>MutVisitor</code> cases</p>



<a name="177345126"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177345126" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177345126">(Oct 04 2019 at 14:43)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> I think the main doubt I have is how would the MIR Visitor interact with that place visitor you're suggesting?</p>



<a name="177345194"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177345194" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177345194">(Oct 04 2019 at 14:44)</a>:</h4>
<p>I understand that we want <code>Place</code> to be a leaf</p>



<a name="177345200"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177345200" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177345200">(Oct 04 2019 at 14:44)</a>:</h4>
<p>that's clear</p>



<a name="177345427"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177345427" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177345427">(Oct 04 2019 at 14:46)</a>:</h4>
<p>but once the MIR visitor do visit_place, I understand that we want to use the TypeFolder methods in particular for projections</p>



<a name="177363208"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177363208" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177363208">(Oct 04 2019 at 17:51)</a>:</h4>
<p>the MIR visitor would do nothing</p>



<a name="177363253"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177363253" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177363253">(Oct 04 2019 at 17:52)</a>:</h4>
<p><strong>individual MIR visitors</strong> might use a type folder or whatever</p>



<a name="177363274"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177363274" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177363274">(Oct 04 2019 at 17:52)</a>:</h4>
<p>that is basically what we do for <code>Ty&lt;'tcx&gt;</code> too, right?</p>



<a name="177363304"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177363304" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177363304">(Oct 04 2019 at 17:52)</a>:</h4>
<blockquote>
<p>the MIR visitor would do nothing</p>
</blockquote>
<p>that is, the MIR visitor <em>trait</em></p>



<a name="177363311"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177363311" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177363311">(Oct 04 2019 at 17:53)</a>:</h4>
<p><span class="user-mention" data-user-id="116266">@Santiago Pastorino</span> <span aria-label="point up" class="emoji emoji-1f446" role="img" title="point up">:point_up:</span></p>



<a name="177363778"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177363778" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177363778">(Oct 04 2019 at 17:58)</a>:</h4>
<p>yeah I guess we are talking or thinking about the same idea</p>



<a name="177363795"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177363795" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177363795">(Oct 04 2019 at 17:58)</a>:</h4>
<p>going to code this and let you know</p>



<a name="177363851"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177363851" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177363851">(Oct 04 2019 at 17:59)</a>:</h4>
<p>when I was saying what would the visitor do I was mainly referring to the default impl, anyway, let me figure out something</p>



<a name="177528194"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177528194" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177528194">(Oct 07 2019 at 15:07)</a>:</h4>
<p>I think <span class="user-mention" data-user-id="116266">@Santiago Pastorino</span> we should probably spend a bit of time auditing the visitors</p>



<a name="177528215"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177528215" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177528215">(Oct 07 2019 at 15:07)</a>:</h4>
<p>yeah, I was taking a look at them</p>



<a name="177528226"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177528226" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177528226">(Oct 07 2019 at 15:07)</a>:</h4>
<p>although I guess it might be useful to kind of convert them one at a time and run tests</p>



<a name="177528249"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177528249" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177528249">(Oct 07 2019 at 15:07)</a>:</h4>
<p>yep</p>



<a name="177528250"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177528250" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177528250">(Oct 07 2019 at 15:07)</a>:</h4>
<p>( I guess you could e.g. just add a <code>visit_place</code> that does nothing to do that )</p>



<a name="177528338"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177528338" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177528338">(Oct 07 2019 at 15:08)</a>:</h4>
<p>my main question was about how to design reuse on this existing design</p>



<a name="177528398"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177528398" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177528398">(Oct 07 2019 at 15:09)</a>:</h4>
<p>basically the idea is that we have a visit_place, visit_place_base and visit_projection all of them with default impls</p>



<a name="177528426"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177528426" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177528426">(Oct 07 2019 at 15:09)</a>:</h4>
<p>what they end doing is traversing all the different parts of the place and end calling visit_ty and visit_local</p>



<a name="177528491"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177528491" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177528491">(Oct 07 2019 at 15:10)</a>:</h4>
<p>so depending on the visitor some just implement visit_ty and/or visit_local and there are some that roll their own visit_place thing or visit_projection thing</p>



<a name="177528552"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177528552" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177528552">(Oct 07 2019 at 15:10)</a>:</h4>
<p>yes</p>



<a name="177528570"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177528570" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177528570">(Oct 07 2019 at 15:11)</a>:</h4>
<p>most of them already have some "core" thing</p>



<a name="177528578"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177528578" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177528578">(Oct 07 2019 at 15:11)</a>:</h4>
<p>my original question was how to keep a design like this when  we want at least, visit_projection, visit_ty and visit_local only for the case of projections to return new</p>



<a name="177528585"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177528585" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177528585">(Oct 07 2019 at 15:11)</a>:</h4>
<p>e.g., <code>visit_substs</code> and <code>visit_ty</code></p>



<a name="177528590"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177528590" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177528590">(Oct 07 2019 at 15:11)</a>:</h4>
<p>are both "leaf" methods for the visitor</p>



<a name="177528594"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177528594" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177528594">(Oct 07 2019 at 15:11)</a>:</h4>
<p>that have types embedded in them</p>



<a name="177528601"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177528601" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177528601">(Oct 07 2019 at 15:11)</a>:</h4>
<p>because visit_ty and visit_local are used from other parts of the visitor</p>



<a name="177528633"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177528633" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177528633">(Oct 07 2019 at 15:12)</a>:</h4>
<p>I think we should just go through the visitors 1 by 1</p>



<a name="177528694"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177528694" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177528694">(Oct 07 2019 at 15:12)</a>:</h4>
<p>most of them don't even look at types, I dont' think</p>



<a name="177528718"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177528718" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177528718">(Oct 07 2019 at 15:12)</a>:</h4>
<p>easier to look at specifics than to discuss in the abstract</p>



<a name="177528725"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177528725" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177528725">(Oct 07 2019 at 15:12)</a>:</h4>
<p>yes</p>



<a name="177528728"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177528728" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177528728">(Oct 07 2019 at 15:12)</a>:</h4>
<p>that's what I was also saying :)</p>



<a name="177528745"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177528745" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177528745">(Oct 07 2019 at 15:12)</a>:</h4>
<p>ok</p>



<a name="177528749"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177528749" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177528749">(Oct 07 2019 at 15:12)</a>:</h4>
<p>I guess the question is <em>when</em> to do that :)</p>



<a name="177528753"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177528753" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177528753">(Oct 07 2019 at 15:12)</a>:</h4>
<p>I could maybe do that later today if you wanted</p>



<a name="177528814"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177528814" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177528814">(Oct 07 2019 at 15:13)</a>:</h4>
<p>Does <code>Place</code> implement "type foldable" btw?</p>



<a name="177528821"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177528821" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177528821">(Oct 07 2019 at 15:13)</a>:</h4>
<p>It does, I think, right?</p>



<a name="177528833"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177528833" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177528833">(Oct 07 2019 at 15:13)</a>:</h4>
<p>yes</p>



<a name="177528844"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177528844" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177528844">(Oct 07 2019 at 15:13)</a>:</h4>
<p>OK</p>



<a name="177528846"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177528846" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177528846">(Oct 07 2019 at 15:13)</a>:</h4>
<p>actually</p>



<a name="177528848"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177528848" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177528848">(Oct 07 2019 at 15:13)</a>:</h4>
<p>I think I can provide a PR with an idea</p>



<a name="177528856"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177528856" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177528856">(Oct 07 2019 at 15:13)</a>:</h4>
<p>if you want I could do that right now :)</p>



<a name="177528961"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177528961" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177528961">(Oct 07 2019 at 15:14)</a>:</h4>
<p>I mean, your help will always help me :) but I don't want to make you waste your time :)</p>



<a name="177528978"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177528978" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177528978">(Oct 07 2019 at 15:14)</a>:</h4>
<p>what if I just start and provide a PR with some code</p>



<a name="177528994"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177528994" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177528994">(Oct 07 2019 at 15:14)</a>:</h4>
<p>will do something not great from the design if needed to discuss</p>



<a name="177529004"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177529004" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177529004">(Oct 07 2019 at 15:15)</a>:</h4>
<p>and we can make progress from there</p>



<a name="177529021"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177529021" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177529021">(Oct 07 2019 at 15:15)</a>:</h4>
<p>ok, that works</p>



<a name="177529048"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177529048" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177529048">(Oct 07 2019 at 15:15)</a>:</h4>
<p>if you want we can aim for some sync time later in case needed (if you have time)</p>



<a name="177529061"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177529061" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177529061">(Oct 07 2019 at 15:15)</a>:</h4>
<p>hoping that is not needed ;)</p>



<a name="177529068"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177529068" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177529068">(Oct 07 2019 at 15:15)</a>:</h4>
<p>I think we can basically "convert"  all the existing visitors such that</p>



<a name="177529080"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177529080" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177529080">(Oct 07 2019 at 15:15)</a>:</h4>
<p>each of them implements <code>visit_place</code> in a way that does not recurse into the visitor</p>



<a name="177529086"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177529086" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177529086">(Oct 07 2019 at 15:15)</a>:</h4>
<p>then remove <code>visit_place</code> from the visitor</p>



<a name="177529097"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177529097" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177529097">(Oct 07 2019 at 15:15)</a>:</h4>
<p>yeah that was my goal</p>



<a name="177529103"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177529103" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177529103">(Oct 07 2019 at 15:15)</a>:</h4>
<p>ok</p>



<a name="177529106"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177529106" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177529106">(Oct 07 2019 at 15:15)</a>:</h4>
<p>I guess would led to a lot of code duplication</p>



<a name="177529109"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177529109" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177529109">(Oct 07 2019 at 15:15)</a>:</h4>
<p>well I'll be around today if you want to ping with specific questions about an individual visitor</p>



<a name="177529164"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177529164" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177529164">(Oct 07 2019 at 15:16)</a>:</h4>
<blockquote>
<p>I guess would led to a lot of code duplication</p>
</blockquote>
<p>maybe, but I bet less than you might think</p>



<a name="177529182"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177529182" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177529182">(Oct 07 2019 at 15:16)</a>:</h4>
<blockquote>
<p>I guess would led to a lot of code duplication</p>
</blockquote>
<p>but this is what I'm hoping to see from real code and stop trying to pre guess things</p>



<a name="177529194"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177529194" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177529194">(Oct 07 2019 at 15:16)</a>:</h4>
<p>ok, <span aria-label="+1" class="emoji emoji-1f44d" role="img" title="+1">:+1:</span>, gonna jump into this right now</p>



<a name="177552488"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177552488" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177552488">(Oct 07 2019 at 19:41)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> was trying things out and seeing which <code>MutVisitor</code>s make use of <code>visit_place</code> in a direct or indirect way</p>



<a name="177552529"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177552529" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177552529">(Oct 07 2019 at 19:41)</a>:</h4>
<div class="codehilite"><pre><span></span>[santiago@galago rust1 (place-mut-visitor-adjusts2)]$ rg -l &quot;impl.*MutVisitor&quot; src/librustc_mir/
src/librustc_mir/transform/no_landing_pads.rs
src/librustc_mir/transform/promote_consts.rs
src/librustc_mir/transform/erase_regions.rs
src/librustc_mir/transform/generator.rs
src/librustc_mir/transform/instcombine.rs
src/librustc_mir/transform/copy_prop.rs
src/librustc_mir/transform/cleanup_post_borrowck.rs
src/librustc_mir/transform/simplify.rs
src/librustc_mir/util/def_use.rs
src/librustc_mir/transform/inline.rs
src/librustc_mir/transform/const_prop.rs
src/librustc_mir/borrow_check/nll/renumber.rs
</pre></div>



<a name="177552639"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177552639" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177552639">(Oct 07 2019 at 19:42)</a>:</h4>
<p><code>no_landing_pads</code> seems to be the only one not used</p>



<a name="177552650"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177552650" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177552650">(Oct 07 2019 at 19:43)</a>:</h4>
<p>going over them</p>



<a name="177552661"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177552661" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177552661">(Oct 07 2019 at 19:43)</a>:</h4>
<p>just for the sake of discussing about something concrete</p>



<a name="177552674"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177552674" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177552674">(Oct 07 2019 at 19:43)</a>:</h4>
<p><code>promote_consts</code> -&gt; <a href="https://github.com/rust-lang/rust/compare/master...spastorino:place-mut-visitor-adjusts2" target="_blank" title="https://github.com/rust-lang/rust/compare/master...spastorino:place-mut-visitor-adjusts2">https://github.com/rust-lang/rust/compare/master...spastorino:place-mut-visitor-adjusts2</a></p>



<a name="177552696"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177552696" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177552696">(Oct 07 2019 at 19:43)</a>:</h4>
<p>it's not a lot of duplication</p>



<a name="177552699"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177552699" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177552699">(Oct 07 2019 at 19:43)</a>:</h4>
<p>just duplicating <a href="https://github.com/rust-lang/rust/compare/master...spastorino:place-mut-visitor-adjusts2#diff-bfc61a84a9e3b48761db14b8d6772a0aL395" target="_blank" title="https://github.com/rust-lang/rust/compare/master...spastorino:place-mut-visitor-adjusts2#diff-bfc61a84a9e3b48761db14b8d6772a0aL395">https://github.com/rust-lang/rust/compare/master...spastorino:place-mut-visitor-adjusts2#diff-bfc61a84a9e3b48761db14b8d6772a0aL395</a></p>



<a name="177552791"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177552791" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177552791">(Oct 07 2019 at 19:44)</a>:</h4>
<p>and well yeah, the visit place_base and iterate over projections</p>



<a name="177552875"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177552875" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177552875">(Oct 07 2019 at 19:45)</a>:</h4>
<p>basically all the stuff that's going to be repeated is we would need to visit place_base, iterate over projections and depending on what the <code>MutVisitor</code> does may need to repeat some of that parts too</p>



<a name="177552894"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177552894" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177552894">(Oct 07 2019 at 19:45)</a>:</h4>
<p>in particular <code>visit_ty</code> and/or <code>visit_local</code></p>



<a name="177552960"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177552960" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177552960">(Oct 07 2019 at 19:46)</a>:</h4>
<p>if implemented because the default impl is empty, what's why in this case there's nothing related to <code>visit_ty</code></p>



<a name="177553000"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177553000" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177553000">(Oct 07 2019 at 19:46)</a>:</h4>
<blockquote>
<p><code>promote_consts</code> -&gt; <a href="https://github.com/rust-lang/rust/compare/master...spastorino:place-mut-visitor-adjusts2" target="_blank" title="https://github.com/rust-lang/rust/compare/master...spastorino:place-mut-visitor-adjusts2">https://github.com/rust-lang/rust/compare/master...spastorino:place-mut-visitor-adjusts2</a></p>
</blockquote>
<p>is that more or less what you were aiming to?, I'm assuming (for now) that projection is immutable but the rest is</p>



<a name="177553013"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177553013" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177553013">(Oct 07 2019 at 19:46)</a>:</h4>
<p>otherwise I can't <code>visit_place_base</code></p>



<a name="177553025"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177553025" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177553025">(Oct 07 2019 at 19:46)</a>:</h4>
<p>but I guess it's a first sane step</p>



<a name="177553584"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177553584" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177553584">(Oct 07 2019 at 19:53)</a>:</h4>
<p>in this particular case the repetition can be easily avoided by provide a function does that the logic</p>



<a name="177556189"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177556189" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177556189">(Oct 07 2019 at 20:19)</a>:</h4>
<p>hmm <span class="user-mention" data-user-id="116266">@Santiago Pastorino</span> yeah that diff looks ok but I agree it's a bit unfortunate; I had forgotten that index places have other places embedded within</p>



<a name="177556234"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177556234" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177556234">(Oct 07 2019 at 20:19)</a>:</h4>
<p>I guess the question is how often this will arise; I could certainly imagine having e.g. a <code>MutPlaceVisitor</code> or something that can extract some of that boilerplate</p>



<a name="177556448"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177556448" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177556448">(Oct 07 2019 at 20:21)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> yeah, I guess I can continue pushing things there and following this way and see how looks like at the end or midroad</p>



<a name="177556586"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177556586" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177556586">(Oct 07 2019 at 20:22)</a>:</h4>
<p>this <a href="https://github.com/rust-lang/rust/compare/master...spastorino:place-mut-visitor-adjusts2" target="_blank" title="https://github.com/rust-lang/rust/compare/master...spastorino:place-mut-visitor-adjusts2">https://github.com/rust-lang/rust/compare/master...spastorino:place-mut-visitor-adjusts2</a> may be a bit better <span aria-label="joy" class="emoji emoji-1f602" role="img" title="joy">:joy:</span></p>



<a name="177556909"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177556909" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177556909">(Oct 07 2019 at 20:24)</a>:</h4>
<blockquote>
<p>hmm <span class="user-mention silent" data-user-id="116266">Santiago Pastorino</span> yeah that diff looks ok but I agree it's a bit unfortunate; I had forgotten that index places have other places embedded within</p>
</blockquote>
<p>btw, what did you mean exactly here?, unsure if we think it is unfortunate for the same reasons</p>



<a name="177581826"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177581826" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177581826">(Oct 08 2019 at 03:45)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> <span class="user-mention" data-user-id="124288">@oli</span> <a href="https://github.com/rust-lang/rust/pull/65197" target="_blank" title="https://github.com/rust-lang/rust/pull/65197">https://github.com/rust-lang/rust/pull/65197</a></p>



<a name="177581874"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177581874" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177581874">(Oct 08 2019 at 03:46)</a>:</h4>
<p>have gone over all the <code>MutVisitor</code>s and changed the ones that needed to be changed, there's some code repetition we can discussing how to make it look better  :)</p>



<a name="177581892"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177581892" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177581892">(Oct 08 2019 at 03:47)</a>:</h4>
<p>there are some unrelated changes like <a href="https://github.com/rust-lang/rust/pull/65197/commits/f7de6eaa8bed19b0b14081ec087ba82850e944c8" target="_blank" title="https://github.com/rust-lang/rust/pull/65197/commits/f7de6eaa8bed19b0b14081ec087ba82850e944c8">https://github.com/rust-lang/rust/pull/65197/commits/f7de6eaa8bed19b0b14081ec087ba82850e944c8</a>, I'm now having second thoughts about it because the code is not more coupled, will take a look tomorrow</p>



<a name="177640468"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177640468" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177640468">(Oct 08 2019 at 17:49)</a>:</h4>
<p>to complete a bit more this discussion, there's the PR</p>



<a name="177640496"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177640496" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177640496">(Oct 08 2019 at 17:49)</a>:</h4>
<p>we need to get rid of some duplication</p>



<a name="177640577"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177640577" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177640577">(Oct 08 2019 at 17:50)</a>:</h4>
<p>I've two extra commits on a new branch that try to setup an idea we were discussing with <span class="user-mention" data-user-id="124288">@oli</span></p>



<a name="177646516"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177646516" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177646516">(Oct 08 2019 at 18:49)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> for when you read all this stuff</p>



<a name="177646522"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177646522" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177646522">(Oct 08 2019 at 18:49)</a>:</h4>
<p>I've pushed everything I have for now <a href="https://github.com/rust-lang/rust/pull/65197" target="_blank" title="https://github.com/rust-lang/rust/pull/65197">https://github.com/rust-lang/rust/pull/65197</a></p>



<a name="177646615"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177646615" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177646615">(Oct 08 2019 at 18:50)</a>:</h4>
<p>the not so great things:</p>



<a name="177646693"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177646693" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177646693">(Oct 08 2019 at 18:51)</a>:</h4>
<ol>
<li><a href="https://github.com/rust-lang/rust/pull/65197/files#diff-f5c3f3fddb41e941652e84ee86bda82aR785-R892" target="_blank" title="https://github.com/rust-lang/rust/pull/65197/files#diff-f5c3f3fddb41e941652e84ee86bda82aR785-R892">https://github.com/rust-lang/rust/pull/65197/files#diff-f5c3f3fddb41e941652e84ee86bda82aR785-R892</a> there's this macro, which is not bad per se, the thing is <code>Visitor</code> and <code>MutVisitor</code> start to diverge and also the <code>process_projection*</code> fns doesn't seem to belong really in a visitor</li>
</ol>



<a name="177646892"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177646892" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177646892">(Oct 08 2019 at 18:53)</a>:</h4>
<ol start="2">
<li>there are a bunch of clones like <a href="https://github.com/rust-lang/rust/pull/65197/files#diff-cbe990e8f20536f68f97230946f44f79R46" target="_blank" title="https://github.com/rust-lang/rust/pull/65197/files#diff-cbe990e8f20536f68f97230946f44f79R46">https://github.com/rust-lang/rust/pull/65197/files#diff-cbe990e8f20536f68f97230946f44f79R46</a> but basically all the clones there. We need to clone if we mutate something, but if the projection stays the same we shouldn't. I was talking with <span class="user-mention" data-user-id="124288">@oli</span> about this, we can probably use CoW to avoid that but until we don't intern there's going to be some sort of problem like that. Still I can keep this PR going and do the interning stuff in this one so we don't land regressions.</li>
</ol>



<a name="177646994"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177646994" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177646994">(Oct 08 2019 at 18:54)</a>:</h4>
<p>those are the two things that I'd like to discuss a bit, about point <code>1.</code> how to make the design better and about point <code>2.</code> how to get rid of unneeded clones</p>



<a name="177678356"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/interning%20next%20steps/near/177678356" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/interning.20next.20steps.html#177678356">(Oct 09 2019 at 03:02)</a>:</h4>
<p>fixed <code>2.</code> so the <a href="https://github.com/rust-lang/rust/pull/65197" target="_blank" title="https://github.com/rust-lang/rust/pull/65197">PR here</a> is ready, the only concern is <code>1.</code> more or less the design of the solution but is ready to be reviewed and discussed /cc <span class="user-mention" data-user-id="116009">@nikomatsakis</span> <span class="user-mention" data-user-id="124288">@oli</span></p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>